package mof.gov.dmdc.view.searchitem;

public class SearchCriteria {
    protected String attrName;
    protected String attrValue;
    protected String lovName;
    protected String attrType;
    protected int viewType;

    public SearchCriteria(String attrName, String attrValue, String lovName, String attrType) {
        super();
        this.attrName = attrName;
        this.attrValue = attrValue;
        this.lovName = lovName;
        this.attrType = attrType;
    }

    public SearchCriteria(String attrValue) {
        super();
        this.attrValue = attrValue;
    }


    public void setAttrName(String attrName) {
        this.attrName = attrName;
    }

    public String getAttrName() {
        return attrName;
    }

    public void setAttrValue(String attrValue) {
        this.attrValue = attrValue;
    }

    public String getAttrValue() {
        return attrValue;
    }

    public void setLovName(String lovName) {
        this.lovName = lovName;
    }

    public String getLovName() {
        return lovName;
    }

    public void setAttrType(String attrType) {
        this.attrType = attrType;
    }

    public String getAttrType() {
        return attrType;
    }

    public void setViewType(int viewType) {
        this.viewType = viewType;
    }

    public int getViewType() {
        if (attrType.equalsIgnoreCase("number")) {
            viewType = 1;
        } else {
            if (attrType.equalsIgnoreCase("date")) {
                viewType = 2;
            } else {
                if (attrType.equalsIgnoreCase("varchar2") && !lovName.isEmpty()) {
                    viewType = 3;
                } else {
                    viewType = 4;
                }
            }
        }
        return viewType;
    }
}
